package com.dongwei.utils;

import sun.misc.BASE64Encoder;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * Created by user on 2017/9/12.
 */
public class Md5 {
    public static String md5Encoding(String input) throws NoSuchAlgorithmException, UnsupportedEncodingException {
        MessageDigest md5=MessageDigest.getInstance("MD5");
        BASE64Encoder encoder=new BASE64Encoder();
        String result=encoder.encode(md5.digest(input.getBytes("UTF-8")));
        return result;
    }
}
